home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mint110s / ctype.h < prev    next >
C/C++ Source or Header  |  1993-08-16  |  2KB  |  42 lines

  1. /*
  2.  *    ctype.h        Character classification and conversion
  3.  */
  4.  
  5. #ifndef _CTYPE_H
  6. #define _CTYPE_H
  7.  
  8. extern    unsigned char    _ctype[];    /* in lib.c */
  9.  
  10. #define    _CTc    0x01        /* control character */
  11. #define    _CTd    0x02        /* numeric digit */
  12. #define    _CTu    0x04        /* upper case */
  13. #define    _CTl    0x08        /* lower case */
  14. #define    _CTs    0x10        /* whitespace */
  15. #define    _CTp    0x20        /* punctuation */
  16. #define    _CTx    0x40        /* hexadecimal */
  17.  
  18. #define    isalnum(c)    (_ctype[(unsigned char)(c)]&(_CTu|_CTl|_CTd))
  19. #define    isalpha(c)    (_ctype[(unsigned char)(c)]&(_CTu|_CTl))
  20. #define    isascii(c)    !((c)&~0x7F)
  21. #define    iscntrl(c)    (_ctype[(unsigned char)(c)]&_CTc)
  22. #define    isdigit(c)    (_ctype[(unsigned char)(c)]&_CTd)
  23. #define    isgraph(c)    (!(_ctype[(unsigned char)(c)]&(_CTc|_CTs)) && (_ctype[(unsigned char)(c)]))
  24. #define    islower(c)    (_ctype[(unsigned char)(c)]&_CTl)
  25. #define isprint(c)      (!(_ctype[(unsigned char)(c)]&_CTc) && (_ctype[(unsigned char)(c)]))
  26. #define    ispunct(c)    (_ctype[(unsigned char)(c)]&_CTp)
  27. #define    isspace(c)    (_ctype[(unsigned char)(c)]&_CTs)
  28. #define    isupper(c)    (_ctype[(unsigned char)(c)]&_CTu)
  29. #define    isxdigit(c)    (_ctype[(unsigned char)(c)]&_CTx)
  30. #define iswhite(c)    isspace(c)
  31.  
  32. #define    _toupper(c)    ((c)^0x20)
  33. #define    _tolower(c)    ((c)^0x20)
  34. #define    toascii(c)    ((c)&0x7F)
  35.  
  36. #define toint(c)    ( (c) <= '9' ? (c) - '0' : toupper(c) - 'A' )
  37. #define isodigit(c)    ( (c)>='0' && (c)<='7' )
  38. #define iscymf(c)    (isalpha(c) || ((c) == '_') )
  39. #define iscym(c)    (isalnum(c) || ((c) == '_') )
  40.  
  41. #endif /* _CTYPE_H */
  42.